/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package descriptor;

import java.util.Collection;

/**
 *
 * @author Alejandro
 */
public final class Template {

    private String name;
    private String alias;
    private String tableName;
    private Iterable<PropertyTemplate> propertyTemplates;
    private Iterable<PresentationTemplate> presentationTemplates;

    public Template() {
        name = null;
        alias = null;
        tableName = null;
        propertyTemplates = null;
        presentationTemplates = null;
    }
    public Template(String name,String alias,String tableName,Iterable<PropertyTemplate> propierties,Iterable<PresentationTemplate> presentations) {
        this.name = name;
        this.alias = alias;
        this.tableName = tableName;
        this.propertyTemplates = propierties;
        this.presentationTemplates = presentations;

    }
    public String getName(){
        return name;
    }
    public String getAlias(){
        return alias;
    }
    public String getTableName(){
        return tableName;
    }
    public Iterable<PropertyTemplate> getPropertyTemplateCollection() {
        return propertyTemplates;
    }

    public Iterable<PresentationTemplate> getPresentationTemplateCollection() {
        return presentationTemplates;
    }

    public PropertyTemplate getPropertyTemplate(String templateName) {
        PropertyTemplate result = null;
        for(PropertyTemplate pt: propertyTemplates) {
            if (pt.getName().equals(templateName)) {
                result = pt;
                break;
            }
        }
        return result;
    }
    
    public PresentationTemplate getPresentationTemplate(String templateAlias){
        PresentationTemplate result = null;
        for(PresentationTemplate pt: presentationTemplates) {
            if (pt.getAlias().equals(templateAlias)) {
                result = pt;
                break;
            }
        }
        return result;        
    }
  
}
